package com.soft.front.web;

import java.io.IOException;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.soft.admin.common.ElementConst;
import com.soft.front.service.TempService;

@Controller
public class TempController {
	private TempService tempService;

	@RequestMapping(value = "/index.jhtml")
	public ModelAndView index(HttpServletResponse response, HttpServletRequest request) 
			throws IOException {
		Map<String, Object> resMap = this.tempService.index();
		return new ModelAndView("index", resMap);
	}
	/**新闻中心**/
	@RequestMapping(value = "/xwzx/index.jhtml")
	public ModelAndView xwzx(HttpServletResponse response, HttpServletRequest request, 
			Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.xwzx("", page);
		return new ModelAndView("xwzx/index", resMap);
	}
	
	@RequestMapping(value = "/xwzx/{channel}/index.jhtml")
	public ModelAndView xwzx(HttpServletResponse response, HttpServletRequest request,
			@PathVariable String channel, Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.xwzx(channel, page);
		return new ModelAndView("xwzx/index", resMap);
	}
	
	@RequestMapping(value = "/xwzx/{channel}/{id}.jhtml")
	public ModelAndView xwzxDetail(HttpServletResponse response, HttpServletRequest request, 
			@PathVariable String channel, @PathVariable Integer id) throws IOException {
		Map<String, Object> resMap = this.tempService.xwzxDetail(channel, id);
		return new ModelAndView("xwzx/detail", resMap);
	}
	/**教科研**/
	@RequestMapping(value = "/jky/index.jhtml")
	public ModelAndView jky(HttpServletResponse response, HttpServletRequest request, 
			Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.jky("", page);
		return new ModelAndView("jky/index", resMap);
	}
	
	@RequestMapping(value = "/jky/{channel}/index.jhtml")
	public ModelAndView jky(HttpServletResponse response, HttpServletRequest request,
			@PathVariable String channel, Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.jky(channel, page);
		return new ModelAndView("jky/index", resMap);
	}
	
	@RequestMapping(value = "/jky/{channel}/{id}.jhtml")
	public ModelAndView jkyDetail(HttpServletResponse response, HttpServletRequest request, 
			@PathVariable String channel, @PathVariable Integer id) throws IOException {
		Map<String, Object> resMap = this.tempService.jkyDetail(channel, id);
		return new ModelAndView("jky/detail", resMap);
	}
	/**实验室一览**/
	@RequestMapping(value = "/sys/index.jhtml")
	public ModelAndView sys(HttpServletResponse response, HttpServletRequest request, 
			Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.sys("", page);
		return new ModelAndView("sys/index", resMap);
	}
	
	@RequestMapping(value = "/sys/{channel}/index.jhtml")
	public ModelAndView sys(HttpServletResponse response, HttpServletRequest request,
			@PathVariable String channel, Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.sys(channel, page);
		return new ModelAndView("sys/index", resMap);
	}
	
	@RequestMapping(value = "/sys/{channel}/{id}.jhtml")
	public ModelAndView sysDetail(HttpServletResponse response, HttpServletRequest request, 
			@PathVariable String channel, @PathVariable Integer id) throws IOException {
		Map<String, Object> resMap = this.tempService.sysDetail(channel, id);
		return new ModelAndView("sys/detail", resMap);
	}
	
	/**中心简介**/
	@RequestMapping(value = "/zxjj/index.jhtml")
	public ModelAndView zxjj(HttpServletResponse response, HttpServletRequest request) throws IOException {
		Map<String, Object> resMap = this.tempService.zxjj(ElementConst.XYJJCONST);
		return new ModelAndView("zxjj/index", resMap);
	}
	
	@RequestMapping(value = "/zxjj/{channel}/index.jhtml")
	public ModelAndView zxjj(HttpServletResponse response, HttpServletRequest request,
			@PathVariable String channel) throws IOException {
		Map<String, Object> resMap = this.tempService.zxjj(channel);
		return new ModelAndView("zxjj/index", resMap);
	}
	
	/**规章制度**/
	@RequestMapping(value = "/gzzd/index.jhtml")
	public ModelAndView gzzd(HttpServletResponse response, HttpServletRequest request, 
			Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.gzzd("", page);
		return new ModelAndView("gzzd/index", resMap);
	}
	
	@RequestMapping(value = "/gzzd/{channel}/index.jhtml")
	public ModelAndView gzzd(HttpServletResponse response, HttpServletRequest request,
			@PathVariable String channel, Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.gzzd(channel, page);
		return new ModelAndView("gzzd/index", resMap);
	}
	
	@RequestMapping(value = "/gzzd/{channel}/{id}.jhtml")
	public ModelAndView gzzdDetail(HttpServletResponse response, HttpServletRequest request, 
			@PathVariable String channel, @PathVariable Integer id) throws IOException {
		Map<String, Object> resMap = this.tempService.gzzdDetail(channel, id);
		return new ModelAndView("gzzd/detail", resMap);
	}
	
	/**师资队伍**/
	@RequestMapping(value = "/szdw/index.jhtml")
	public ModelAndView szdw(HttpServletResponse response, HttpServletRequest request) 
			throws IOException {
		Map<String, Object> resMap = this.tempService.szdw(ElementConst.XYBCONST);
		return new ModelAndView("szdw/index", resMap);
	}
	
	@RequestMapping(value = "/szdw/{channel}/index.jhtml")
	public ModelAndView szdw(HttpServletResponse response, HttpServletRequest request,
			@PathVariable String channel) throws IOException {
		Map<String, Object> resMap = this.tempService.szdw(channel);
		return new ModelAndView("szdw/index", resMap);
	}
	
	@RequestMapping(value = "/szdw/{channel}/{id}.jhtml")
	public ModelAndView szdwDetail(HttpServletResponse response, HttpServletRequest request, 
			@PathVariable String channel, @PathVariable Integer id) throws IOException {
		Map<String, Object> resMap = this.tempService.szdwDetail(channel, id);
		return new ModelAndView("szdw/detail", resMap);
	}
	
	/**仪器设备**/
	@RequestMapping(value = "/yqsb/index.jhtml")
	public ModelAndView yqsb(HttpServletResponse response, HttpServletRequest request, 
			Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.yqsb("", page);
		return new ModelAndView("yqsb/index", resMap);
	}
	
	@RequestMapping(value = "/yqsb/{channel}/index.jhtml")
	public ModelAndView yqsb(HttpServletResponse response, HttpServletRequest request,
			@PathVariable String channel, Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.yqsb(channel, page);
		return new ModelAndView("yqsb/index", resMap);
	}
	
	@RequestMapping(value = "/yqsb/{channel}/{id}.jhtml")
	public ModelAndView yqsbDetail(HttpServletResponse response, HttpServletRequest request, 
			@PathVariable String channel, @PathVariable Integer id) throws IOException {
		Map<String, Object> resMap = this.tempService.yqsbDetail(channel, id);
		return new ModelAndView("yqsb/detail", resMap);
	}
	
	/**下载中心**/
	@RequestMapping(value = "/xzzx/index.jhtml")
	public ModelAndView xzzx(HttpServletResponse response, HttpServletRequest request, 
			Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.xzzx("", page);
		return new ModelAndView("xzzx/index", resMap);
	}
	
	@RequestMapping(value = "/xzzx/{channel}/index.jhtml")
	public ModelAndView xzzx(HttpServletResponse response, HttpServletRequest request,
			@PathVariable String channel, Integer page) throws IOException {
		Map<String, Object> resMap = this.tempService.xzzx(channel, page);
		return new ModelAndView("xzzx/index", resMap);
	}
	
	@RequestMapping(value = "/xzzx/{channel}/{id}.jhtml")
	public ModelAndView xzzxDetail(HttpServletResponse response, HttpServletRequest request, 
			@PathVariable String channel, @PathVariable Integer id) throws IOException {
		Map<String, Object> resMap = this.tempService.xzzxDetail(channel, id);
		return new ModelAndView("xzzx/detail", resMap);
	}
	
	@Autowired
	public void setTempService(TempService tempService) {
		this.tempService = tempService;
	}
}
